package com.util;

import com.server.chart.TimeConverterUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CalculationJudgeUtil {
    @Autowired
    TimeConverterUtil timeConverterUtil;

    public static String Judge(String type){
        if (type == null || "".equals(type) || "sum".equals(type)){
            return "sum";
        }else if ("count".equals(type)){
            return "count";
        }else if ("max".equals(type)){
            return "max";
        }else if ("min".equals(type)){
            return "min";
        }else if ("avg".equals(type)){
            return"avg";
        }else if ("distinctCount".equals(type)){
            return "distinct count";
        }else {
            return "sum";
        }
    }

    /*
    X轴，或饼图图例
     */
//    public List<String> xData(String xColumnType, String xColumn, String tableName, String xAxisType){
//        //X轴
//        //判断是否为日期类型
//        if ("time".equals(xColumnType)){
//            xAxisData = timeConverterUtil.timeConverter(xColumn, tableName, xAxisType);
//            xData = timeConverterUtil.toRespons(xAxisData,xAxisType );
//            System.out.println("data:"+xAxisData);
//        }else {
//            xAxisData = showChartsMapper.getXAxis(xColumn, tableName);
//
//        }
//
//        if ("week".equals(xAxisType) || "month".equals(xAxisType) || "quarter".equals(xAxisType)){
//            return xData;
//        }else {
//            return xAxisData;
//        }
//
//    }
}
